{extends 'base/site2.html'}
{block name="page_header"}{include file="common/header.html" inline}{/block}
{block name="page_nav"}{include file="common/slide-nav.html" inline}{/block}
{block name="page_styles"}
<link rel="stylesheet" type="text/css" href="/css/mediation/submitrepair/index.css" />
<style>
    .modal.in .modal-dialog{
        transform: translate(0,50%)!important;
    }
</style>
{/block}
{block name="page_section"}
<div class="sessionPage">
    <div class="page-header">
      <div class="left">
        <span class="line"></span>
        <strong class="tit">
            修复提交
        </strong>
      </div>
    </div>
    <form class="small-style" method="get" action="" role="validform" enctype="multipart/form-data">
        <div class="form_row">
          <input type="hidden" name="is_show" class="showmoreishow" value="{if $is_show == 1}1{else}0{/if}">
          <input type="hidden" name="limit" value="{if $query.limit}{$query.limit}{/if}">
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">用户标签:</label>
              <div class="col-sm-7">
                  <select class="form-control selectpicker"   title="请选择" name="search[customLabel]" id="customLabel">
                      {foreach from=$customLabel key=key  item=info}
                      <option class="u144_input_option" {if !empty($query.search.customLabel) &&  $key == $query.search.customLabel}selected="selected"{/if} value="{$key}">{$info}</option>
                      {/foreach}
                  </select>
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">导入批次ID:</label>
              <div class="col-sm-7">
                  <input type="text" class="form-control noempty col-sm-4"  value="{if !empty($query.search.importRecordId)}{$query.search.importRecordId}{/if}" name="search[importRecordId]" id="importRecordId" placeholder="请输入~">
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">移动复联状态:</label>
              <div class="col-sm-7">
                  <select class="form-control selectpicker"   title="请选择" name="search[ydRepairStatus]" id="ydRepairStatus">
                      <option class="u144_input_option" {if !empty($query.search.ydRepairStatus) &&  9 == $query.search.ydRepairStatus}selected="selected"{/if} value="9">未修复</option>
                      <option class="u144_input_option" {if !empty($query.search.ydRepairStatus) &&  1 == $query.search.ydRepairStatus}selected="selected"{/if} value="1">成功</option>
                      <option class="u144_input_option" {if !empty($query.search.ydRepairStatus) &&  2 == $query.search.ydRepairStatus}selected="selected"{/if} value="2">失败</option>
                  </select>
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">联通复联状态:</label>
              <div class="col-sm-7">
                  <select class="form-control selectpicker"   title="请选择" name="search[ltRepairStatus]" id="ltRepairStatus">
                      <option class="u144_input_option" {if !empty($query.search.ltRepairStatus) &&  9 == $query.search.ltRepairStatus}selected="selected"{/if} value="9">未修复</option>
                      <option class="u144_input_option" {if !empty($query.search.ltRepairStatus) &&  1 == $query.search.ltRepairStatus}selected="selected"{/if} value="1">成功</option>
                      <option class="u144_input_option" {if !empty($query.search.ltRepairStatus) &&  2 == $query.search.ltRepairStatus}selected="selected"{/if} value="2">失败</option>
                  </select>
              </div>
          </div>
        </div>
        <div class="form_row">
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">用户等级:</label>
              <div class="col-sm-7">
                  <select class="form-control selectpicker"   title="请选择" name="search[customGrade]" id="customGrade">
                      {foreach from=$customGrade key=key  item=info}
                      <option class="u144_input_option" {if !empty($query.search.customGrade) &&  $key == $query.search.customGrade}selected="selected"{/if} value="{$key}">{$info}</option>
                      {/foreach}
                  </select>
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">逾期期数M:</label>
              <div class="col-sm-7">
                  <input type="number" class="form-control"  value="{if !empty($query.search.startoverdueMonth)}{$query.search.startoverdueMonth}{/if}" name="search[startoverdueMonth]" placeholder="大于该值">
                  -
                  <input type="number" class="form-control"  value="{if !empty($query.search.endoverdueMonth)}{$query.search.endoverdueMonth}{/if}" name="search[endoverdueMonth]" placeholder="小于该值" >
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">借款期限:</label>
              <div class="col-sm-7">
                  <input type="number" style="" class="form-control"  value="{if !empty($query.search.startloanTerm)}{$query.search.startloanTerm}{/if}" name="search[startloanTerm]" placeholder="大于该值">
                  -
                  <input type="number" style="" class="form-control"  value="{if !empty($query.search.endloanTerm)}{$query.search.endloanTerm}{/if}" name="search[endloanTerm]" placeholder="小于该值" >
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">欠款总本金:</label>
              <div class="col-sm-7">
                  <input type="number" class="form-control"  value="{if !empty($query.search.startdebtAmount)}{$query.search.startdebtAmount}{/if}" name="search[startdebtAmount]" placeholder="大于该值">
                  -
                  <input type="number" class="form-control"  value="{if !empty($query.search.enddebtAmount)}{$query.search.enddebtAmount}{/if}" name="search[enddebtAmount]" placeholder="小于该值">
              </div>
          </div>
        </div>
        <div class="start-hide col-lg-12 form_row" data-isshow="{if $is_show == 1}true{else}false{/if}" {if $is_show == 1}style="padding:0px;"{else}style="padding:0px;display:none;"{/if}>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">调解部门:</label>
              <div class="col-sm-7">
                  <select class="form-control selectpicker"    title="请选择" name="search[mediationOrganId]" id="mediationOrganId">
                      {foreach from=$mediationOrgan  item=info}
                      <option class="u144_input_option" {if !empty($query.search.mediationOrganId) &&  $info.id== $query.search.mediationOrganId}selected="selected"{/if} value="{$info.id}">{$info.name}</option>
                      {/foreach}
                  </select>
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">调解员:</label>
              <div class="col-sm-7">
                  <select class="form-control selectpicker"   title="请选择" name="search[mediatorId]" id="mediatorId">
                      {foreach from=$mediator  item=info}
                      {if $info.id != 1}
                      <option class="u144_input_option" {if !empty($query.search.mediatorId) &&  $info.id == $query.search.mediatorId}selected="selected"{/if} value="{$info.id}">{$info.name}</option>
                      {/if}
                      {/foreach}
                  </select>
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">资产方:</label>
              <div class="col-sm-7">
                  <select class="form-control selectpicker"   title="请选择" name="search[assetsId]" id="assetsId">
                      {foreach from=$assets  item=info}
                      <option class="u144_input_option" {if !empty($query.search.assetsId) &&  $info.id == $query.search.assetsId}selected="selected"{/if} value="{$info.id}">{$info.name}</option>
                      {/foreach}
                  </select>
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">案件标识号:</label>
              <div class="col-sm-7">
                  <input type="text" class="form-control noempty col-sm-4"  value="{if !empty($query.search.batshId)}{$query.search.batshId}{/if}" name="search[batshId]" id="batshId" placeholder="请输入~">
              </div>
          </div>
        </div>
        <div class="start-hide col-lg-12 form_row" data-isshow="{if $is_show == 1}true{else}false{/if}" {if $is_show == 1}style="padding:0px;"{else}style="padding:0px;display:none;"{/if}>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">系统案件号:</label>
              <div class="col-sm-7">
                  <input type="text" class="form-control noempty col-sm-4"  value="{if !empty($query.search.id)}{$query.search.id}{/if}" name="search[id]" id="id" placeholder="请输入~">
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">当事人:</label>
              <div class="col-sm-7">
                  <input type="text" class="form-control noempty col-sm-4"  value="{if !empty($query.search.litigantName)}{$query.search.litigantName}{/if}" name="search[litigantName]" id="litigantName" placeholder="请输入~">
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label for="exampleInputName2"  class="col-sm-4 control-label">当事人身份证:</label>
              <div class="col-sm-7">
                  <input type="text" class="form-control noempty col-sm-4"  value="{if !empty($query.search.cardId)}{$query.search.cardId}{/if}" name="search[cardId]" id="cardId" placeholder="请输入~">
              </div>
          </div>
          <div class="form-group col-lg-3 ui-select">
              <label class="col-sm-4 control-label">
                  入库时间:
              </label>
              <div class="col-sm-7">
                  <input data-ele="date" data-type="daterange" name="search[addTime]" class="form-control" placeholder="请选择" value="{if !empty($smarty.get.addTime)}{$smarty.get.addTime}{/if}" autocomplete="off"/>
              </div>
          </div>
          <input type="hidden" name="is_search" value="1" />
        </div>
        <div class="form_row col-lg-12">
          <div class="form-group col-lg-3 ui-select">
            <div class="col-lg-5">
                <button class="btn btn-primary col-lg-8 shousuoBtn"><span class="nav-icon glyphicon glyphicon-search" aria-hidden="true" style="margin-right: 2px"></span>查询</button>
            </div>
            <div class="col-lg-5">
                <a type="button" href="/repairsubmit" class="btn btn-default col-lg-8"><span class="nav-icon glyphicon glyphicon-refresh" aria-hidden="true" style="margin-right: 2px"></span>重置</a>
            </div>
            <div class="col-lg-5">
                <a type="button" href="javascript:;" class="btn btn-default col-lg-8 show-more-btn">》更多</a>
            </div>
          </div>
          <div class="ui-select"></div>
          <div class="ui-select"></div>
          <div class="ui-select"></div>
        </div>
    </form>
    <div style="width: 95%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow-x: scroll;">
      <table class="table table-striped table-bordered table-hover text-nowrap" id="tab">
            <thead>
            <tr>

                <th><input type="checkbox" class="checkall" style="vertical-align: text-bottom"></th>
                <th>当事人</th>
                <th>当事人身份证</th>
                <th>案件数</th>
                <th>欠款总本金</th>
                <th>欠款总额</th>
                <th>最大逾期期限</th>
            </thead>
            <tbody>
            {foreach from=$arrList item=item name=foo}
            <tr>
                <td> <input name="checkItem" class="j-check" type="checkbox" value="{$item.id}"></td>
                <td>{$item.litigantName}</td>
                <td>{substr_replace($item.cardId, '****', 15, 4)}</td>
                <td>{$item.caseNum}</td>
                <td>{$item.debtAmount}</td>
                <td>{$item.debtTotal}</td>
                <td>M{$item.overdueMonth}</td>
            </tr>
            {/foreach}
            </tbody>
        </table>
    </div>
      <div class="mr-b20 col-lg-12 pad-no" style="float:none;">
          <input type="button" value="移动修复" data-toggle="modal" data-target="#modal_repair" class="btn btn-primary casesubmit" repair_type="1">
          <input type="button" value="联通修复" data-toggle="modal" data-target="#modal_repair" class="btn btn-primary casesubmit" repair_type="2">
      </div>
    <div class="clearfix pad-no text-nowrap" style="margin-top: 20px;">
        {include file="base/pagenav.html"  action="/repairsubmit/index" pagenum=$curPageNum inline}
        <select class="form-control" id="paglimit" style="float:right;margin:0 10px;width: auto;margin-top: -5px;">
            <option value="limit=50" {if $query.limit==50}selected="selected"{/if}>50条/页</option>
            <option value="limit=100" {if $query.limit==100}selected="selected"{/if}>100条/页</option>
            <option value="limit=500" {if $query.limit==500}selected="selected"{/if}>500条/页</option>
            <option value="limit=1000" {if $query.limit==1000}selected="selected"{/if}>1000条/页</option>
        </select>
        <span style="float:right;">共 {$totalnum} 条</span>
    </div>

<div class="modal fade" id="modal_repair" tabindex="-1" role="dialog" aria-labelledby="refusal_modal" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">

            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="exampleModalLabel">失联修复</h4>
            </div>
            <div class="modal-body">
                <form id="withdraw_form">
                    <div class="clearfix modal-body">
                        <div class="form_dialog form-group col-sm-12" >
                            <label for="exampleInputName2"  class="col-sm-3 control-label">批次名称:</label>
                            <div class="col-sm-7">
                                <input type="text" class="form-control noempty" style="width: 100%"  id="batchName"  placeholder="例如：{$batchName}" >
                            </div>
                        </div>
                    </div>
                    <p> 即将对 <span style="color: green" id="chean_num"></span> 件案件进行 <span style="color: red" id="audit_status"></span> 失联修复  ,请确认是否继续!<p >
                <input type="hidden" value="" id="repair_type" name="repair_type">
                </form>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button type="button" class="btn btn-default" id="fpclosebtn" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary distribution">确定</button>
            </div>


        </div>
    </div>
</div>
<div class="modal fade" id="sms_modal" tabindex="-1" role="dialog" aria-labelledby="sms_modal" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">

            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="exampleModalLabel">短信发送</h4>
            </div>
            <div class="modal-body" style="display:flex;">
                <form id="entrustExpireTime_form">
                    <div class="form-group col-lg-10 ui-select">
                        <label for="exampleInputName2"  class="col-sm-3 control-label">短信模板:</label>
                        <div class="col-sm-8">
                            <select class="form-control" id="sms">
                                <option value="" >——请选择——</option>
                                {foreach from=$sms item=info}
                                <option class="u144_input_option"  smscontent="{$info.content}" value="{$info.code}">{$info.name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <input type="hidden" value="1" id="batch">
                    <div id="smscontentdiv" class="form-group col-lg-10 ui-select"  style="display: none">
                        <label for="exampleInputName2"  class="col-sm-3 control-label">内容:</label>
                        <div class="col-sm-8">
                            <textarea id="smscontent" disabled="disabled" class="form-control" cols="50" rows="7"></textarea>
                        </div>
                    </div>

                    </br>

                </form>

            </div>

            <div class="modal-footer" style="text-align: center;">
                <button type="button" class="btn btn-default" id="fpclosebtn" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary determine">确定</button>
            </div>


        </div>
    </div>
</div>


{/block}
{block name="page_scripts"}
<script type="text/template" id="smsTpl">
    {foreach from=$sms item=sms1}
    <li code = "{$sms1.code}" data-fn="only-sms" val="{$sms1.content}"><a>{$sms1.name}</a></li>
    {/foreach}
</script>
<script type="text/javascript" src="/js/mediation/repairsubmit/index.min.js" init="mediation/repairsubmit/index"></script>
<script type="text/javascript" src="/js/module/date.js"></script>
<script type="text/javascript">
    $(".casesubmit").on("click",function(){
        var arrbtn = [];
        $(".j-check:checked").each(function (index, ele) {
            //遍历所有复选框，然后取值进行 !非操作
            if ($(this).prop("checked")) {
                arrbtn.push($(this).val());
            }
        })
        if(arrbtn.length==0){
            toastr.error('请选择案件');
            return false;
        }
        $("#repair_type").val($(this).attr('repair_type'));

        $("#chean_num").text(arrbtn.length);
        if($(this).attr('repair_type') == 1){
            $("#audit_status").text("移动");
        }else{
            $("#audit_status").text("联通");
        }

    });
    function GetQueryString(name){
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }
    $('body')

        .on('change','#paglimit', function(){
            console.log()
            var mediationOrganId = GetQueryString('mediationOrganId');
            var paglimit = GetQueryString('limit');
            var status = GetQueryString('status');
            var val =  $(this).val();

            if(!mediationOrganId){
                if(!paglimit && status!=null){
                    window.location = window.location.href+'&'+val;
                }else if(!paglimit){
                    window.location = window.location.href+'?'+val;
                }else{
                    window.location = window.location.href.replace('limit='+paglimit,val);
                }
            }else{
                if(!paglimit){
                    window.location = window.location.href+'&'+val;
                } else{
                    window.location = window.location.href.replace('limit='+paglimit,val);
                }
            }
        })


</script>
{/block}
